package domain;

import java.util.Collection;
import java.util.HashSet;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.NotBlank;

@Entity
@Access(AccessType.PROPERTY)
public class Gallery extends DomainEntity {
	//Constructors

		public Gallery() {
			super();
		paintings = new HashSet<Painting>();			
		}

		//Attributes
		private String title;

		@NotBlank
		public String getTitle() {
			return title;
		}

		public void setTitle(String title) {
			this.title = title;
		}
		

		// Relationships//
		private Customer customer;
		private Collection<Painting> paintings;
		
		@NotNull
		@Valid
		@ManyToOne(optional = false)
		public Customer getCustomer() {
			return customer;
		}

		public void setCustomer(Customer customer) {
			this.customer = customer;
		}
		
		@OneToMany(mappedBy = "gallery")
		public Collection<Painting> getPaintings() {
			return paintings;
		}

		public void setPaintings(Collection<Painting> paintings) {
			this.paintings = paintings;
		}
		
		

}
